<template>
    <div class="body">
        <div class="container">
            <div class="buy-succ-box clearfix">
                <div id="J_goodsBox" class="goods-content">
                    <div class="goods-img">
                        <img src="@/assets/img/success.png" width="64" height="64" />
                    </div>
                    <div class="goods-info">
                        <h3>已成功加入购物车！</h3>
                        <span class="name">{{ goodsItem.goodsName }} X {{ goodsItem.goodsNum }}</span>
                    </div>
                </div>
                <div class="actions J_actBox">
                    <a @click="goBack" class="btn btn-line-gray J_goBack">返回上一级</a>
                    <!-- <router-link to="/shopcart" class="btn btn-primary">去购物车结算</router-link> -->
                    <a @click="goShopCart" class="btn btn-primary">去购物车结算</a>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    computed: {
        // 获取添加进购物车的商品名称
        goodsItem() {
            return this.$route.query.goodsItem;
        },
    },
    methods: {
        goBack() {
            this.$router.go(-1);
        },
        goShopCart() {
            this.$router.replace("/shopcart");
        },
    },
};
</script>

<style scoped lang="less">
.body {
    width: 100%;
    min-height: calc(100vh - 120px);
    box-sizing: border-box;
    padding: 38px 0 130px;

    .container {
        -webkit-text-size-adjust: 100%;
        font: 14px/1.5 Helvetica Neue, Helvetica, Arial, Microsoft Yahei,
            Hiragino Sans GB, Heiti SC, WenQuanYi Micro Hei, sans-serif;
        color: #333;
        width: 1226px;
        margin-right: auto;
        margin-left: auto;

        .buy-succ-box {
            color: #333;
            margin-bottom: 26px;
            padding: 0 0 28px 0;
            height: 68px;
            border-bottom: 1px solid #e0e0e0;

            .goods-content {
                color: #333;
                float: left;

                .goods-img {
                    float: left;
                    width: 64px;
                    height: 64px;
                }

                .goods-info {
                    color: #333;
                    float: left;
                    margin-left: 20px;

                    h3 {
                        margin: 0;
                        color: #424242;
                        font-size: 24px;
                        font-weight: 400;
                        margin-top: 3px;
                    }

                    .name {
                        margin-right: 15px;
                        font-size: 14px;
                        color: #757575;
                    }
                }
            }

            .actions {
                color: #333;
                float: right;

                .J_goBack {
                    text-decoration: none;
                    display: inline-block;
                    height: 38px;
                    padding: 0;
                    margin: 0;
                    border: 1px solid #b0b0b0;
                    font-size: 14px;
                    line-height: 38px;
                    text-align: center;
                    cursor: pointer;
                    transition: all 0.4s;
                    border-color: #b0b0b0;
                    color: #b0b0b0;
                    width: 180px;
                    margin-left: 12px;
                    margin-top: 5px;
                    background: none;
                }

                .btn-primary {
                    text-decoration: none;
                    display: inline-block;
                    height: 38px;
                    padding: 0;
                    margin: 0;
                    border: 1px solid #b0b0b0;
                    font-size: 14px;
                    line-height: 38px;
                    text-align: center;
                    cursor: pointer;
                    transition: all 0.4s;
                    background: #ff6700;
                    border-color: #ff6700;
                    color: #fff;
                    width: 180px;
                    margin-left: 12px;
                    margin-top: 5px;
                }
            }
        }
    }
}
</style>